package com.googlecode.npgame.simulation;

/**
 * Keeps score statistics.
 * 
 * @author Josh (joshbruning)
 */
public class Score {

  protected long maxScore;
  protected long score;
  protected int elementCount;
  protected long elementScore;
  protected int missedCount;
  protected long missedScore;
  protected int duplicateCount;
  protected long duplicateScore;
  protected int invalidCount;
  protected long invalidScore;
  protected long frameCount;
  protected long frameScore;
  protected long timeScore;

  public Score() {
    this.maxScore = 0;
    this.score = 0;
    this.elementCount = 0;
    this.elementScore = 0;
    this.missedCount = 0;
    this.missedScore = 0;
    this.duplicateCount = 0;
    this.duplicateScore = 0;
    this.invalidCount = 0;
    this.invalidScore = 0;
    this.frameCount = 0;
    this.frameScore = 0;
    this.timeScore = 0;
  }

  public long getScore() {
    return this.score;
  }

  public long getMaxScore() {
    return this.maxScore;
  }

  public void addElement(Element element, int oldFrameSize) {
    // TODO(joshbruning): Implement
    this.elementCount++;

    updateMaxScore();
  }

  public void addMissed(Element element) {
    // TODO(joshbruning): Implement
    this.missedCount++;

    updateMaxScore();
  }
  
  public void addDuplicate(Element element) {
    // TODO(joshbruning): Implement
    this.duplicateCount++;

    updateMaxScore();
  }

  public void addInvalid(Element element) {
    // TODO(joshbruning): Implement
    this.invalidCount++;

    updateMaxScore();
  }

  public void addFrame(Frame frame) {
    // TODO(joshbruning): Implement
    this.frameCount++;

    updateMaxScore();
  }

  public void addTimeScore(long ms, long expectedMs) {
    // TODO(joshbruning): Implement

    updateMaxScore();
  }

  private void updateMaxScore() {
    if (this.score > this.maxScore) {
      this.maxScore = score;
    }
  }
}
